<!DOCTYPE html>
<html>

<head>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>- 日历</title>
  <meta name="keywords" content="">
  <meta name="description" content="">

  <link rel="shortcut icon" href="favicon.ico">
  <link href="css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
  <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">

  <link href="css/plugins/iCheck/custom.css" rel="stylesheet">

  <link href="css/plugins/fullcalendar/fullcalendar.css" rel="stylesheet">
  <link href="css/plugins/fullcalendar/fullcalendar.print.css" rel="stylesheet">

  <link href="css/animate.css" rel="stylesheet">
  <link href="css/style.css?v=4.1.0" rel="stylesheet"></head>

<body class="gray-bg">
  <div class="wrapper wrapper-content">
    <div class="row animated fadeInDown">
      <div class="col-sm-3">
        <div class="ibox float-e-margins">
          <div class="ibox-title">
            <h5>Draggable Events</h5>
            <div class="ibox-tools">
              <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
              </a>
              <a class="dropdown-toggle" data-toggle="dropdown" href="calendar.html#"> <i class="fa fa-wrench"></i>
              </a>
              <ul class="dropdown-menu dropdown-user">
                <li>
                  <a href="calendar.html#">选项1</a>
                </li>
                <li>
                  <a href="calendar.html#">选项2</a>
                </li>
              </ul>
              <a class="close-link">
                <i class="fa fa-times"></i>
              </a>
            </div>
          </div>
          <div class="ibox-content">
            <div id='external-events'>
              <p>可拖动的活动</p>
              <div class='external-event navy-bg'>完成防伪二维码打印工作</div>
              <div class='external-event navy-bg'>检测任务跟踪</div>
              <div class='external-event navy-bg'>完成本月检测任务</div>
              <div class='external-event navy-bg'>检查设备标定情况 </div>
              <p class="m-t">
                <input type='checkbox' id='drop-remove' class="i-checks" checked />
                <label for='drop-remove'>移动后删除</label>
              </p>
            </div>
          </div>
        </div>
      </div>
      <div class="col-sm-9">
        <div class="ibox float-e-margins">
          <div class="ibox-title">
            <h5>工作内容布置</h5>
            <div class="ibox-tools">
              <a class="collapse-link">
                <i class="fa fa-chevron-up"></i>
              </a>
              <a class="dropdown-toggle" data-toggle="dropdown" href="calendar.html#">
                <i class="fa fa-wrench"></i>
              </a>
              <ul class="dropdown-menu dropdown-user">
                <li>
                  <a href="calendar.html#">选项1</a>
                </li>
                <li>
                  <a href="calendar.html#">选项2</a>
                </li>
              </ul>
              <a class="close-link">
                <i class="fa fa-times"></i>
              </a>
            </div>
          </div>
          <div class="ibox-content">
            <div id="calendar"></div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <!-- 全局js -->
  <script src="js/jquery.min.js?v=2.1.4"></script>
  <script src="js/bootstrap.min.js?v=3.3.6"></script>

  <!-- 自定义js -->
  <script src="js/content.js?v=1.0.0"></script>

  <script src="js/jquery-ui.custom.min.js"></script>

  <!-- iCheck -->
  <script src="js/plugins/iCheck/icheck.min.js"></script>

  <!-- Full Calendar -->
  <script src="js/plugins/fullcalendar/fullcalendar.min.js"></script>

  <script>
    $(document).ready(function () {

      $('.i-checks').iCheck({
          checkboxClass: 'icheckbox_square-green',
          radioClass: 'iradio_square-green',
      });

        /* initialize the external events
         -----------------------------------------------------------------*/

        $('#external-events div.external-event').each(function () {

          // create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
          // it doesn't need to have a start or end
          var eventObject = {
            title: $.trim($(this).text()) // use the element's text as the event title
          };

          // store the Event Object in the DOM element so we can get to it later
          $(this).data('eventObject', eventObject);

          // make the event draggable using jQuery UI
          $(this).draggable({
            zIndex: 999,
            revert: true, // will cause the event to go back to its
            revertDuration: 50 //  original position after the drag
          });

        });


        /* initialize the calendar
         -----------------------------------------------------------------*/
        var date = new Date();
        var d = date.getDate();
        var m = date.getMonth();
        var y = date.getFullYear();

        $('#calendar').fullCalendar({
            header: {
              left: 'prev,next',
              center: 'title',
              right: 'month,agendaWeek,agendaDay'
            },
            editable: true,
            droppable: true, // this allows things to be dropped onto the calendar !!!
            drop: function (date, allDay) { // this function is called when something is dropped
              // retrieve the dropped element's stored Event Object
              var originalEventObject = $(this).data('eventObject');

              // we need to copy it, so that multiple events don't have a reference to the same object
              var copiedEventObject = $.extend({}, originalEventObject);

              // assign it the date that was reported
              copiedEventObject.start = date;
              copiedEventObject.allDay = allDay;

              // render the event on the calendar
              // the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
              $('#calendar').fullCalendar('renderEvent', copiedEventObject, true);

              // is the "remove after drop" checkbox checked?
              if ($('#drop-remove').is(':checked')) {
                  // if so, remove the element from the "Draggable Events" list
                  $(this).remove();
              }

            },
            events: [
              {
                  title: '检查设备维保记录',
                  start: new Date(y, m, 1)
              },
              {
                  title: '月度安全会议',
                  start: new Date(y, m, d - 5),
                  end: new Date(y, m, d - 2),
              },
              {
                  id: 999,
                  title: '月度安全会议',
                  start: new Date(y, m, d - 3, 16, 0),
                  allDay: false,
              },
              {
                  id: 999,
                  title: '例会',
                  start: new Date(y, m, d + 4, 16, 0),
                  allDay: false
              },
              {
                  title: '例会',
                  start: new Date(y, m, d, 10, 30),
                  allDay: false
              },
              {
                  title: '陈主任生日',
                  start: new Date(y, m, d, 12, 0),
                  end: new Date(y, m, d, 14, 0),
                  allDay: false
              }
          ],
        });


    });
    </script>

</body>

</html>